# ejemplo. Encontrar ruta mas corta
# con algoritmo de Floyd

import networkx as nx
g = nx.DiGraph()
g.add_edge('a','b',weight=1)
g.add_edge('b','c',weight=2)
g.add_edge('c','d',weight=2)
g.add_edge('c','e',weight=4)
g.add_edge('e','d',weight=5)
g.add_edge('d','c',weight=3)
g.add_edge('d','b',weight=1)

predecesor, distance = nx.floyd_warshall_predecessor_and_distance(g)
print "distancia mas corta: "
print distance

print
print "predecesores: "
print predecesor







